خرید بک لینک

Vote count: 0

I'm having some problems with loading a pkl file using pickle. I'm using windows 7, Python 3.5.1 64 bit and zodbpickle 0.6.0. The pkl file was downloaded from here: https://s3.amazonaws.com/lasagne/recipes/pretrained/imagenet/vgg16.pkl

This is my code:

from zodbpickle import pickle

# Load model weights and metadata
weightFile = open('vgg16.pkl', 'rb')
d = pickle.load(weightFile)

and when I run it I get the output

UnicodeDecodeError: 'ascii' codec can't decode byte 0xbc in position 1: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/work/lasagne/tutorial/lasagne-tutorial2.py", line 5, in <module>
    d = pickle.load(weightFile)
SystemError: <built-in method read of _io.BufferedReader object at 0x000000000101C678> retued a result with an error set

Process finished with exit code 1

What could be the cause of this problem?

asked 6 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 22:59

Vote count: 0

I am trying to get the basic user login ruing from the FOSUserBundle. I am using Symfony 3.0.6.

I followed the description to setup everything from the FOSUserBundle: https://symfony.com/doc/master/bundles/FOSUserBundle/index.html

DB is up and ruing everything seems fine except I cant figure out how to override the layout.html.twig from the FOSUserBundle. I followed this description for achieving that: https://symfony.com/doc/master/bundles/FOSUserBundle/overriding_templates.html

I now have a file "layout.html.twig" in the folder "Resources/FOSUserBundle/views" with the content being the same as in the last link provided above. This leads to the following error:

Unable to find template "layout.html.twig" (looked into: [somePathInfo]) in FOSUserBundle::layout.html.twig at line 1.

Now I changed the first line in the "layout.html.twig" Template to be

{% extends 'FOSUserBundle::layout.html.twig' %}

And this then leads to the symfony server to crash stating

>php bin/console server:run -v                                                                                                                       
 [OK] Server ruing on http://127.0.0.1:8000                                                                           
 // Quit the server with CONTROL-C.
  RUN  "C:xamppphpphp.exe" "-S" "127.0.0.1:8000" "[PATH]myProjectvendorsymfonysymfonysrcSymfonyBundleFrameworkBundleResourcesconfigrouter_dev.php"
  RES  -1073741571 Command did not run successfully
 [ERROR] Built-in server terminated unexpectedly.

I am stuck here... Any ideas are very welcome.

asked 6 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 22:59

Vote count: 0

I have 30 JToggleButton. If they get pressed, I want to pass the i and the title into another class .

 confirm.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        boolean buttonClicked = false;
                        for (i = 0; i < 30; i++) {
                            if (ButtonList[i].isSelected()) {
                                buttonClicked = true;
                                System.out.print(i+1);
                                System.out.println(title);
                            }
                        }
                       // System.out.println(title);
                         if (!buttonClicked) {
                            JFrame parent= new JFrame();
                            JOptionPane.showMessageDialog(parent, "You haven't select a seat");
                        }
                    }

                });

The above code give me this output (Assume 2 toggle button clicked )

1Marvel's Captain America

2Marvel's Captain America

I only want title display once, so I decided to move

System.out.println(title); 

above code

if (!buttonClicked) {

My question is how can I store the array i into a object so that it can pass with the title in a new function called pass() ? The number of title printed seems following the total number of toggleButton clicked. How to avoid this ?

asked 6 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 22:59

Vote count: 0

how can one cancel an Export Database operation in Azure. I kicked one off thinking it would be rather quick on my 150 MB database. That was 2 hours ago, and it's only 30% done. No users are coected to that database.

Any help is appreciated. This is quite excruciating.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 21:49

Vote count: 0

Jenkins installation that was previously ruing is no longer booting. When trying to access if via web, I get an HTTP 503 error due to the service being unavailable.

CentOS 6.7 java version "1.6.0_39" OpenJDK Runtime Environment (IcedTea6 1.13.11) (rhel-1.13.11.0.el6_7-x86_64) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

I've tried installing several font packages, and have checked that it's ruing in headless mode. It is.

Here is the stack trace:

SEVERE: Failed to initialize Jenkins
hudson.util.AWTProblem: java.lang.NullPointerException
    at hudson.WebAppMain.contextInitialized(WebAppMain.java:182)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:282)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at winstone.Launcher.<init>(Launcher.java:154)
    at winstone.Launcher.main(Launcher.java:354)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at Main._main(Main.java:293)
    at Main.main(Main.java:98)
Caused by: java.lang.NullPointerException
    at sun.font.FontManager.getDefaultPlatformFont(FontManager.java:3409)
    at sun.java2d.SunGraphicsEnvironment$2.run(SunGraphicsEnvironment.java:263)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.java2d.SunGraphicsEnvironment.<init>(SunGraphicsEnvironment.java:164)
    at sun.awt.X11GraphicsEnvironment.<init>(X11GraphicsEnvironment.java:254)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:534)
    at java.lang.Class.newInstance(Class.java:379)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
    at sun.font.FontManager.initSGEnv(FontManager.java:1121)
    at sun.font.FontManager.findFont2D(FontManager.java:1876)
    at java.awt.Font.getFont2D(Font.java:477)
    at java.awt.Font.getFamily(Font.java:1198)
    at java.awt.Font.getFamily_NoClientCode(Font.java:1172)
    at java.awt.Font.getFamily(Font.java:1164)
    at java.awt.Font.toString(Font.java:1661)
    at hudson.util.ChartUtil.<clinit>(ChartUtil.java:229)
    at hudson.WebAppMain.contextInitialized(WebAppMain.java:181)
    ... 19 more
May 20, 2016 9:07:53 AM org.eclipse.jetty.util.log.JavaUtilLog wa
WARNING: Failed startup of context w.{,file:/var/cache/jenkins/war/},/var/cache/jenkins/war
java.lang.NullPointerException
    at jenkins.util.groovy.GroovyHookScript.run(GroovyHookScript.java:63)
    at hudson.util.BootFailure.publish(BootFailure.java:43)
    at hudson.WebAppMain.contextInitialized(WebAppMain.java:244)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:282)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at winstone.Launcher.<init>(Launcher.java:154)
    at winstone.Launcher.main(Launcher.java:354)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at Main._main(Main.java:293)
    at Main.main(Main.java:98)

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 21:49

Vote count: 0

Im trying compile OpenCV 3.1.0 on a EC2 instance with ubuntu 14.04.

But I log this error:

Scaing dependencies of target opencv_python2
[100%] Building CXX object    modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
/home/ubuntu/opencv/modules/python/src2/cv2.cpp:6:20: fatal error: Python.h: No such file or directory
#include <Python.h>
                ^
compilation terminated.
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make: *** [all] Error 2

I've compile OpenCV via SSH and nohup:

nohup sudo make > file.log &

I've generated the make file for OpenCV in this way:

cmake -D BUILD_opencv_gpu=OFF -D WITH_CUDA=OFF -D WITH_1394=OFF -D 
BUILD_opencv_gpu=OFF -D WITH_CUDA=OFF -D WITH_1394=OFF -D 
BUILD_opencv_video=OFF -D BUILD_opencv_calib3d=OFF -D 
BUILD_opencv_fla=OFF -D BUILD_opencv_photo=OFF -D 
BUILD_opencv_stitching=OFF -D BUILD_opencv_cudaarithm=OFF -D 
BUILD_opencv_cudabgsegm=OFF -D BUILD_opencv_cudacodec=OFF -D 
BUILD_opencv_cudafeatures2d=OFF -D BUILD_opencv_cudafilters=OFF -D 
BUILD_opencv_cudaimgproc=OFF -D BUILD_opencv_cudalegacy=OFF -D       
BUILD_opencv_cudaobjdetect=OFF -D BUILD_opencv_cudaoptflow=OFF -D
BUILD_opencv_cudastereo=OFF -D BUILD_opencv_cudawarping=OFF -D 
BUILD_opencv_cudev=OFF -D BUILD_opencv_superres=OFF -D 
BUILD_opencv_videostab=OFF -D BUILD_opencv_viz=OFF -D 
BUILD_opencv_aruco=OFF -D BUILD_opencv_bioinspired=OFF -D 
BUILD_opencv_d=OFF -D BUILD_opencv_dpm=OFF -D BUILD_opencv_face=OFF -D 
BUILD_opencv_fuzzy=OFF -D BUILD_opencv_saliency=OFF -D BUILD_opencv_sfm=OFF -D 
BUILD_opencv_stereo=OFF -D BUILD_opencv_structured_light=OFF -D 
BUILD_opencv_tracking=OFF -D BUILD_opencv_ximgproc=OFF -D 
BUILD_opencv_xobjdetect=OFF -D BUILD_opencv_xphoto=OFF -D 
BUILD_EXAMPLES=OFF -D WITH_OPENCL=OFF -D WITH_FFMPEG=OFF -D WITH_QT=OFF -D 
CMAKE_BUILD_TYPE=RELEASE -D INSTALL_C_EXAMPLES=OFF -D 
INSTALL_PYTHON_EXAMPLES=OFF  -D 
OPENCV_EXTRA_MODULES_PATH=/home/ubuntu/opencv_contrib/modules/ -D 
PYTHON2_INCLUDE_DIR=/usr/include/python2.7 -D 
PYTHON2_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so -D 
PYTHON2_NUMPY_INCLUDE_DIRS=/usr/lib/python2.7/dist-packages/numpy/core/include/ ../

I have already installed python-dev. Any Suggestions?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 21:49

Vote count: -1

In given data, how to retrieve time and subject values based on "Day" object. i.e For Monday:Subject and Time

{ "Error": null, "IntealError": null, "IsSuccessful": true, "Message": null, "Days": [ { "Day": "Monday", "Periods": [ { "IsBreak": false, "Period": "1st Period", "Subject": "English", "Time": "08:30AM 09:15AM" },

    {
      "IsBreak": false,
      "Period": "Last Period",
      "Subject": "Computers",
      "Time": "02:45PM 03:25PM"
    }
  ]
},
{
  "Day": "Tuesday",
  "Periods": [
    {
      "IsBreak": false,
      "Period": "1st Period",
      "Subject": "English",
      "Time": "08:30AM 09:15AM"
    },
    {
      "IsBreak": false,
      "Period": "2nd Period",
      "Subject": "Hindi",
      "Time": "09:15AM 09:50AM"
    },

    {
      "IsBreak": false,
      "Period": "5th Period",
      "Subject": "Physics",
      "Time": "11:20AM 11:55AM"
    },

  ]
},
{
  "Day": "Wednesday",
  "Periods": [
    {
      "IsBreak": false,
      "Period": "I",
      "Subject": "Biology",
      "Time": "09:00AM 09:45AM"
    },
    {
      "IsBreak": false,
      "Period": "II",
      "Subject": "Hindi",
      "Time": "09:45AM 10:30AM"
    },
    {
      "IsBreak": false,
      "Period": "III",
      "Subject": "Maths",
      "Time": "10:30AM 11:15AM"
    },

  ]
},
{
  "Day": "Thursday",
  "Periods": [
    {
      "IsBreak": false,
      "Period": "1st Period",
      "Subject": "English",
      "Time": "08:30AM 09:15AM"
    },
    {
      "IsBreak": false,
      "Period": "2nd Period",
      "Subject": "Arabic",
      "Time": "09:15AM 09:50AM"
    },



    }
  ]
},
{
  "Day": "Friday",
  "Periods": [
    {
      "IsBreak": false,
      "Period": "1st Period",
      "Subject": "Music",
      "Time": "08:30AM 09:15AM"
    },
    {
      "IsBreak": false,
      "Period": "2nd Period",
      "Subject": "Computers",
      "Time": "09:15AM 09:50AM"
    },
    {
      "IsBreak": false,
      "Period": "3rd Period",
      "Subject": "Physics",
      "Time": "10:10AM 10:45AM"
    }
  ]
}

] }

asked 7 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 20:41

Vote count: 0

I want to delete only empty folders from directory before last 30 days using batch. I am using following batch command to delete empty folders but i want to delete only those empty folder which modification date is before 30 days.

for /f "delims=" %%d in ('dir "c:fileworksystem_temp" /s /b /ad ^| sort /r') do rd "%%d"

asked 7 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 20:41

Vote count: 1

I have an issue with my serialization. what I need to achieve is the following xml output:

<?xml version="1.0" encoding="utf-8"?>
<Import xmlns_xsi="http://www.w3.org/2001/XMLSchema-instance" xsi_noNamespaceSchemaLocation="TR-DGU%20Import-Schema%20V2015%20-%20Stand%20M%C3%A4rz%202016.xsd">
    <creationDate>2016-05-19</creationDate>
    <hospitalCode>A-0000-A</hospitalCode>
    <importCasesWithErrors>1</importCasesWithErrors>
    <caseList>
            <case>
                <patientCode>A</patientCode>
                <intealPatientId>123456</intealPatientId>
            </case>
            <case>
                <patientCode>B</patientCode>
                <intealPatientId>asdasdasdasd</intealPatientId>
            </case>
    </caseList>
</Import>

But what I get is the following output with an additional xml level which I need to get rid of (Note the Entry "CaseNotNeeded"):

<?xml version="1.0" encoding="utf-8"?>
<Import xmlns_xsi="http://www.w3.org/2001/XMLSchema-instance" xsi_noNamespaceSchemaLocation="TR-DGU%20Import-Schema%20V2015%20-%20Stand%20M%C3%A4rz%202016.xsd">
    <creationDate>2016-05-19</creationDate>
    <hospitalCode>A-0000-A</hospitalCode>
    <importCasesWithErrors>1</importCasesWithErrors>
    <caseList>
        **<CaseNotNeeded>**
            <case>
                <patientCode>A</patientCode>
                <intealPatientId>123456</intealPatientId>
            </case>
            <case>
                <patientCode>B</patientCode>
                <intealPatientId>asdasdasdasd</intealPatientId>
            </case>
        **</CaseNotNeeded>**
    </caseList>
</Import>

I need to have a list of cases (CaseItems) in the List (CaseList) but I get always this additional entry. Anybody an idea how to get rid of that?

Any hint is very much appreciated!

My code looks like this:

CaseList.cs

namespace Serialization.Model
{
    [Serializable]
    [XmlRoot("Import")]
    public class CaseList 

    {
        [XmlArrayItem("case", typeof(CaseItem))]

        public List<CaseItem> CaseNotNeeded
        {
            get;
            set;
        }

        public CaseList()
        {
            CaseNotNeeded = new List<CaseItem>();
        }
    }
}

CaseItem.cs

namespace Serialization.Model
{
    [Serializable]
    //[XmlRoot("case")]
    public class CaseItem
    {

        [XmlElement("patientCode")]
        public string PatientCode { get; set; }

        [XmlElement("intealPatientId")]
        public string IntealPatientId { get; set; }

        public CaseItem()
        {
        }
    }
}

Import.cs

namespace Serialization.Model
{
    [Serializable]
    [XmlRootAttribute(ElementName = "Import", IsNullable = false)]
    public class Import 
    {
        [XmlAttribute("xmlns_xsi")]
        public string XMLNS { get; set; }

        [XmlAttribute("xsi_noNamespaceSchemaLocation")]
        public string XMLNSLocation { get; set; }

        [XmlElement("creationDate")]
        public string CreationDate { get; set; }

        [XmlElement("hospitalCode")]
        public string HospitalCode { get; set; }

        [XmlElement("importCasesWithErrors")]
        public int ImportCasesWithErrors { get; set; }

        [XmlElement("caseList")]
        public CaseList CaseList { get; set; }

        public Import()
        { 
        }
    }
}

and finally in the main method:

.............
.............
.............
import.CaseList = new CaseList();

CaseItem case_1 = new CaseItem();
case_1.IntealPatientId = "123456";
case_1.PatientCode = "A";
import.CaseList.CaseNotNeeded.Add(case_1);

CaseItem case_2 = new CaseItem();
case_2.IntealPatientId = "asdasdasdasd";
case_2.PatientCode = "B";
import.CaseList.CaseNotNeeded.Add(case_2);

asked 7 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 20:41

Vote count: 0

I have several domains with and different tracking Ids - each domain has it's own tracking ID.

I'm using following directive to insert correct ID:

app.directive('analytics', ['$compile', function($compile) {
retu {
    restrict: 'A',
    scope: {
        id: '=analytics'
    },
    link: function (scope) {
        var el =  $("#analytics");
        var text = "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ";
        scope.$watch('id', function (trackId) {
            if (trackId) {
                $(el).append(text, "ga('create','" + trackId + "', 'auto');");
            }
            $compile(el)(scope);
        })
    }
};}]);

and <script id="analytics" type="text/javascript"></script> Sure, i can just create script tag and insert to the head, instead of using id.

I got an error Missing HTTP Response

Missing HTTP Response denotes that, while the Google Analytics code was detected in the page source, the script itself did not execute. Each time the Google Analytics script executes, we expect an HTTP Response carrying the tracking request to Google’s servers. This means that the Google Analytics code is not implemented properly on the page and no data will be collected.

If I manually add tracking id to index.html - no errors. But I still receive data in Google Analytics somehow, but receive following error message in Google Analytics:

No valid tracking code found for property. Make sure your pages are tagged with a supported version of the tracking code.

Is there any valid way to add tracking ID dynamically?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 18:41

Vote count: 0

When I apply the kurtosis function on a pandas datafame I always get following error: "AttributeError: Caot access callable attribute 'kurt' of 'DataFrameGroupBy' objects, try using the 'apply' method". The following sample code works with all other statistical functions (mean(), skew(), ...), but not with kurtosis.

df = pd.DataFrame([[0,1,1,0,0,1],[0,1,2,4,5]]).T
df.columns = ['a','b']
df.groupby('a').kurt()

Any idea how I can apply kurtosis after groupby ? Thanks !

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 18:41

Vote count: 0

I have 4 tables users, user_details, categories and galleries I want to show all record in one query. See below my table structure

categories

id
name

users

id
useame
email
password
user_type
is_active (0 or 1)
created_at
modified_at

user_details

id
user_id
category_id
name
gender
address
phone

galleries

id
user_id
name
image
is_active

I want to get all the user information which user id=1 with user_details and category and show her/her all the is_active=1 images from the galleries table

Here is my code -

@user_details = User.eager_load(:Category,:Gallery,:UserDetail).where('users.id'=>20, 'users.is_active'=>1, 'users.user_type'=>2, 'galleries.is_active'=>1).first()

Here I am getting error message:

Association named 'Category' was not found on User; perhaps you misspelled it?

Actually I have associate Category in the UserDetails model. So I am unable to get the Category data. Please see my all models -

category.rb

class Category < ActiveRecord::Base
  has_many :UserDetail
end

user.rb

class User < ActiveRecord::Base
  #before_save :encrypt_password
  has_one :UserDetail, dependent: :destroy
  has_many :Gallery, dependent: :destroy
end

user_detail.rb

class UserDetail < ActiveRecord::Base
  belongs_to :User
  belongs_to :Category
end

gallery.rb

class Gallery < ActiveRecord::Base
  belongs_to :User
end

Let me know why categories table not joining. Please Help me for this query.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 18:41

Vote count: 0

What is the best way to ensure that a query string does not get included as part of HTTP Referrer data?

I have noticed that some potentially sensitive information (e.g. UTM fields, which do not really require SSL) may otherwise leak.

The objective is for an originating URL such as:

http://mywebsite.com/mypage/?myvar=xxx

To be passed as referrer only as:

http://mywebsite.com/mypage/

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 17:40

Vote count: 0

I have the following function now i want to select only name and some other column from this method i have try this

private QueryOver<Request> CreateFilter(RequestFilterDTO filter)
{
    var query = QueryOver.Of<Request>()
    query.SelectList(list => list
        .Select(pr => pr.Name)
        .Select(pr => pr.Color)
        .Select(pr => pr.ListPrice)
        .List<Request>();
    retu query;
}

This give me an error NHibeate.Criterion.Lambda.QueryOverProjectionBuilder<Optime.SWF.Model.Requests.Request> does not contain a definition for List and no extension method List accepting a first argument of type NHibeate.Criterion.Lambda.QueryOverProjectionBuilder<Optime.SWF.Model.Requests.Request> could be found (are you missing a using directive or an assembly reference?)

how i can fix this?

Note : The retu type i want to QueryOver<Request> with the selection then i send the createfilter method to my Base Repository

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 17:40

Vote count: 0

I am new to Postgresql, and I am trying to change the data type of a column from Integer to Varchar(20), but I get strange error:

ERROR: operator does not exist: character varying <> integer : No operator matches the given name and argument type(s). You might need to add explicit type casts.********** Error **********

The script I wrote to create the table is:

CREATE TABLE LOGIN( USERNAME INTEGER NOT NULL CHECK(USERNAME != NULL), PASSWORD VARCHAR(10) NOT NULL CHECK(PASSWORD <>'' AND USERNAME != NULL) );

This is the script I used to modify the column from Integer to Varchar:

ALTER TABLE LOGIN ALTER COLUMN USERNAME TYPE varchar(20);

I appreciate any help. Thanks.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 17:40

Vote count: 0

I have a C# service application ruing on a production machine. The service's job is to sync with another API every 60 seconds. However recently some really bizarre errors started to show up.

The error message itself is pretty straightforward - failed entity validation. However the path of the file in which the error occurred is the one I'm using when developing locally.

So the server path of the app is "C:/CronJobs/AppName/.." (1), while my local path is "C:/Users/MyLocalUseame/Local/Source/Repos/.." (2).

So the issue is the production server is throwing some errors, and then says that the error occurred in files in "C:/Users/MyLocalUseame/Local/Source/Repos/..", and this location doesn't even exist on the production server, it exists only on my local machine.

I've checked the Host name logged in the database and it's certain that it's coming from the production server. The database itself is protected anyway so I don't even have direct access to it, I have to RDP to manage it.

I restarted the application and it still persists (no errors thrown while it was tued off though).

Can somebody give me any clue where to look to resolve this problem?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 16:37

Vote count: 0

I'm using the swagger-jersey2-jaxrs Maven plugin to serve my current Swagger spec file which works fine. Now I want to automate the generation of a Java client library to that specification, for example using the swagger-codegen-maven-plugin Maven plugin.

swagger-codegen-maven-plugin requires the path to the Swagger spec file as an argument. Is there a way to configure swagger-jersey2-jaxrs to store that spec file to disk? That way I could always generate the Java sources without having to download the spec file by hand and then starting the swagger-codegen-maven-plugin task.

I'm not sure if this is the way to go but I'm open to other approaches. The goal is to always have a Java client library that is in sync with the current state of implementation.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 16:37

Vote count: 0

I try to do a UICollectionView that print 1,5 cell on screen, and with the scroll you should be able to display the next cells. But here is the problem, I arrive to display 1,5 cell but I can't scroll. I don't know why, when I set the layout "scrollDirection" property to "Horizontal" that create a Vertical scroll.

Here is the layout and UICollectionView initialization:

let screenSize = UIScreen.mainScreen().bounds
let widthImage = (screenSize.width - CGFloat(8)) / 1.5
let heightImage = UIUtils.getHeightAspectRatio(widthImage)
//let sizeCollectionView: CGSize = CGSize(width: widthImage, height: heightImage)

let layout = UICollectionViewFlowLayout()
layout.itemSize = CGSize(width: widthImage, height: heightImage)

howTo = UICollectionView(frame: self.view.bounds, collectionViewLayout: layout)
howTo!.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "howToCell")
howTo!.tag = 0
howTo!.delegate = self
howTo!.dataSource = self
self.view.addSubview(howTo!)
howTo!.snp_makeConstraints { (make) -> Void in
  make.top.equalTo(readMoreText.snp_bottom).offset(5)
  make.leading.equalTo(self.view).offset(5)
  make.trailing.equalTo(self.view)
  make.height.equalTo(115)
}
howTo?.backgroundColor = UIColor.whiteColor()
howTo?.contentMode = .ScaleToFill
howTo?.scrollEnabled = true

And here is the method called when you display the cell:

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
if collectionView.tag == howTo!.tag {
  let cell = collectionView.dequeueReusableCellWithReuseIdentifier("howToCell", forIndexPath: indexPath)
  if let url = NSURL(string:UIUtils.getImageUrl(self.exercise.getHowTos()[indexPath.row].getImages(), label: Image.mediumWide)) {
    let screenSize = UIScreen.mainScreen().bounds
    let widthImage = (screenSize.width - CGFloat(8)) / 1.5
    let heightImage = UIUtils.getHeightAspectRatio(widthImage)
    let img = UIImageView(frame: CGRect(x: 0, y: 0, width: widthImage, height: heightImage))
    img.af_setImageWithURL(url)
    cell.contentView.addSubview(img)
    cell.backgroundView = cell.contentView
  } else {
    let img = UIImageView(frame: cell.frame)
    img.image = R.image.appIconTemp()
    cell.contentView.addSubview(img)
    cell.backgroundView = cell.contentView
    //cell.backgroundColor = UIColor.blackColor()
  }

If you have any idea why I can't scroll you'll made my day !

Thanks

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 16:37

Vote count: 0

I have successfully gotten my page to look how I'd like it to look for different size pages. I'm using it to ensure an animation stays in the right place on a page uses percentages.

I'm using @media(min-width: ---px)for each different size. However the page will only accept the different size media css after the page is refreshed.

Is there any way around this, disabling any cache settings or anything. I would understand why as the @media is for different size devices not different size pages on the same device however it would solve my problem.

#car {
    max-width: 10%;
    max-height: 10%;
    z-index: 2;
    -webkit-animation-name: drive;
    -webkit-animation-duration: 4s;
    animation-name: drive;
    animation-duration: 4s;
    animation-iteration-count:infinite;
}

@-webkit-keyframes drive {
    0%   {left:-10%; top: 15%;}
    100%  {left:110%; top: 15%;}
}

@media(min-width: 750px) {
    @-webkit-keyframes drive {
        0%   {left:-10%; top: 16%;}
        100%  {left:110%; top: 16%;}
    }
}

@media(min-width: 850px) {
    @-webkit-keyframes drive {
        0%   {left:-10%; top: 16%;}
        100%  {left:110%; top: 16%;}
    }
}

@media(min-width: 950px) {
    @-webkit-keyframes drive {
        0%   {left:-10%; top: 17%;}
        100%  {left:110%; top: 17%;}
    }
}

@media(min-width: 1050px) {
    @-webkit-keyframes drive {
        0%   {left:-10%; top: 18%;}
        100%  {left:110%; top: 18%;}
    }
}

@media(min-width: 1150px) {
    @-webkit-keyframes drive {
        0%   {left:-10%; top: 18%;}
        100%  {left:110%; top: 18%;}
    }
}

@media(min-width: 1250px) {
    @-webkit-keyframes drive {
        0%   {left:-10%; top: 19%;}
        100%  {left:110%; top: 19%;}
    }
}

@media(min-width: 1350px) {
    @-webkit-keyframes drive {
        0%   {left:-10%; top: 20%;}
        100%  {left:110%; top: 20%;}
    }
}

asked 5 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 15:28

Vote count: 0

If i need an empty list, I could used Arrays.asList() or Collections.emptyList(), what is the difference between these two calls, which I should use?

asked 4 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 15:28

Vote count: 0

I need to create auto-increment version mechanism via Gradle. For this I use this manual and create two files

#Fri May 20 11:04:03 EEST 2016
VERSION_BUILD=3

    def versionPropsFile = file('version.properties')

    if (versionPropsFile.canRead()) {
        def Properties versionProps = new Properties()
        versionProps.load(new FileInputStream(versionPropsFile))
        def versionBuild = versionProps['VERSION_BUILD'].toInteger() + 1
        versionProps['VERSION_BUILD'] = versionBuild.toString()
        versionProps.store(versionPropsFile.newWriter(), null)

        defaultConfig {
            applicationId "test.app.com"
            minSdkVersion 18
            targetSdkVersion 23
            multiDexEnabled true
            versionCode  1
            versionName versionBuild
        }
    } else {
        throw new GradleException("Could not read version.properties!")
    }

The my problem is : VERSION_BUILD increments each time when I build project. Not a Run, just a build. And don't matter I Run project or create a signed APK.

The my goal - increment version only when I generate signed APK. How I can do that?

asked 4 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 15:28

Vote count: 0

I have below script to extract the current open file path in Gedit.

#!/bin/bash
origPath=$GEDIT_CURRENT_DOCUMENT_URI
if [[ $origPath == *"smb"* ]]
then
    finalPath=`php -f /var/www/html/pathswapcmd.php smb_path=$origPath`;
else
    finalPath=$origPath;
fi
## echo -n $finalPath;
echo -n $finalPath | sed 's/^.*app/app/p' | xclip -sel clip;
exit;

Generally I have Magento files in my system so my path needs to start from app, skin folders etc. only.

Now when I try to remove everything before app with sed it removes but it gives the path three times separated with a junk character which is not identifiable(ofcourse) in the address bar of Ubuntu folder manager.

I want simple and clear solution of removing duplicate lines from sed command.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 14:27

Vote count: 0

I created a menu and sub menus on my WordPress site. The theme was made by me from scratch. However, the submenus are always on display (instead of hidden when not active or hovered).

How do I make the submenus only display on hover? Is this kind of feature not existent on WordPress by default and will need more code tweaking?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 14:27

Vote count: 0

I have an existing SSIS package on my DB server and I have another server which is the application server which uses this DB server for its operation. This SSIS package, is being used by a job ruing on the DB server. I would like to add an additional step. That step is just a basic select count(*) query to get count from one table. I implemented that on my test server and gave the output path in the advanced tab as well. And i got the output in a simple text file. My question now is, How do i send this output file to my application server instead? Because the output path of a T-SQL server seems to only take local drives. I tried giving the path of my application server(which was being used by the SSIS package already) but the output doesn't come on the text file even 'though it says the job executed successfully. I don't see the necessity to create another SSIS package for just getting a simple count info.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 14:27

Vote count: 0

I have an ec2 instance ruing a djngo application, and for the database i've an AWS-RDS postgresql. So how can I coect my database to the django application

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 13:19

Vote count: 0

I'm configuring my network's firewall to permit coecting to my Mac build server when I'm away from my house. I would like to set up port forwarding to send traffic to the Mac via an alteative to port 22.

Can the Xamarin Mac Agent be configured to listen on a port other than 22? Does Visual Studio permit coecting to the Mac Agent on a port other than 22?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 13:19

Vote count: 0

I want the below functionality in MVC razor.

<asp:Button ID="Button1" runat="server" Text="Delete"   onclick="Button1_Click"  OnClientClick="CheckDelete()"/>

I used

@Html.ActionLink("Delete", "Action", "Controller", new {  onClientclick = "checkDelete();" }, null)

But this is not working.

asked 53 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 13:19

Vote count: 0

I try to copy many records from Firebird to MongoDB. This is my function;

var queue = 0;
coection.sequentially(sql, (row) => {
    queue++;
    collection.insert(row, (err, result) => {
        if (err)
            retu done(err);
        queue--;
        if (queue <= 0)
          retu done(null, result);
    });
}, (err) => {
    coection.detach();
    done(err);
}

My problem is memory. Write operations are slower and after approx 100000 reads is my memory full. Is it possible to delay next read until the value of queue goes down under some level?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 12:15

Vote count: 0

I'm using some theme which has it's own testimonials widget. How I can provide user ability to write testimonials via form on the site?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 12:15

Vote count: 0

hi guys I am new in android programming to be honest I dont know where to start, I had this project, a capstone project where I will create a Library application ruing in android but i dont know how to make the sqlite or its database available online. Please do help. thanks ^^

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 12:15

صفحه بندی